﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BL
{
   public class Enum
    {
       public struct ConnectionMode {
           public const string Goble = "G";
           public const string Local = "L";
       }
       public struct NumberType {

           public const string Over3 = "O3";
           public const string Under3 = "U3";
           public const string Tod3 = "T3";
           public const string Over2 = "O2";
           public const string Under2 = "U2";
           public const string Tod2 = "T2";
           public const string Over1 = "O1";
           public const string Over1Unit = "O1U";
           public const string Over1Decimal = "O1D";
           public const string Over1Hundet = "O1H";
           public const string Under1 = "U1";
           public const string Under1Decimal = "U1D";
           public const string Under1unit = "U1U";
           public const string TwinFront = "TF";
           public const string TwinStretch = "TS";
           public const string FourNumber = "FN";
           public const string FiveNumber = "FIN";

           
           public const string NumberOverAdd = "NO";
           public const string NumberUnderAdd = "NU";
         
       }
       public struct UpdateType {
           public const string Over = "OV";
           public const string Under = "Un";
           public const string Tod = "Td";
       }
    }
   public class Permute
   {
       public int count = 0;
       public List<string> result { get; set; }
       private void swap(ref char a, ref char b)
       {

           if (a == b) return;

           a ^= b;

           b ^= a;

           a ^= b;

       }

       public void setper(char[] list)
       {

           int x = list.Length - 1;

           go(list, 0, x);

       }

       private void go(char[] list, int k, int m)
       {

           int i;

           if (k == m)
           {
               string numCheck = new string(list);
               if (result == null)
               {
                   result = new List<string>();

               }
               bool canAddToResult = (from n in result where n == numCheck select n).ToList().Count == 0;
               if (canAddToResult)
               {
                   result.Add(numCheck);
                 //  Console.Write(list);
                   count += 1;
                 //  Console.WriteLine(" ");
               }



           }

           else

               for (i = k; i <= m; i++)
               {

                   swap(ref list[k], ref list[i]);

                   go(list, k + 1, m);

                   swap(ref list[k], ref list[i]);

               }

       }
   }
}
